package com.xinchao.model.vo;

/**
 * 总时长、观看人次DTO
 * @author dxy
 * @date 2018/11/12 12:53
 */
public class DeviceAvgWatchSumVO implements Comparable{
	/**
	 * 机器码
	 */
	private String deviceNumber;
	/**
	 * 详细地址
	 */
	private String detailAddress;

	/**
	 * 平均观看时长
	 */
	private Double avgWatchSum;

	public String getDeviceNumber() {
		return deviceNumber;
	}

	public void setDeviceNumber(String deviceNumber) {
		this.deviceNumber = deviceNumber;
	}

	public String getDetailAddress() {
		return detailAddress;
	}

	public void setDetailAddress(String detailAddress) {
		this.detailAddress = detailAddress;
	}

	public Double getAvgWatchSum() {
		return avgWatchSum;
	}

	public void setAvgWatchSum(Double avgWatchSum) {
		this.avgWatchSum = avgWatchSum;
	}

	@Override
	public int compareTo(Object o) {
		/*把Object类型强转为DeviceAvgWatchSumVO类型*/
		DeviceAvgWatchSumVO vo = (DeviceAvgWatchSumVO) o;
		Double thisAvgSum = this.avgWatchSum;
		Double voAvgSum = vo.getAvgWatchSum();
		//如果为空，返回-1
		if (thisAvgSum == null || voAvgSum == null) {
			return -1;
		}
		/*当相等时返回0*/
		if (thisAvgSum.equals(vo.getAvgWatchSum())){
			return 0;
		} else if (thisAvgSum < voAvgSum){
			//当this小于obj时返回正数
			return 1;
		} else {
			//当this小于obj时返回负数
			return -1;
		}
	}
}
